import { lazy, Suspense } from "react"
import React, { Children } from 'react';
import ToDoList from '../components/ToDoList/ToDoList';
// import Heros from '../components/Heros/Heros';
// import Duanzi from '../components/pages/duanzi/Duanzi';
// import News from '../components/News/News';
import Guoji from '../components/News/guonei';
import Guonei from '../components/News/guoji';
import Homes from '../components/Home/home';
import Refs from '../components/Home/Refs';
import Redux from "../components/Redux/Redux";
// import Herotext from '../components/pages/HeroList/Herotext/Herotext';
import { BrowserRouter, Routes, Route, Link, NavLink, useRoutes, Navigate } from "react-router-dom"
let Heros = lazy(() => import('../components/Heros/Heros'))
let Herotext = lazy(() => import('../components/pages/HeroList/Herotext/Herotext'))
let Duanzi = lazy(() => import('../components/pages/duanzi/Duanzi'))
let News = lazy(() => import('../components/News/News'))
let load = (Components) => {
    return<Suspense fallback={<div>正在加载中.......</div>}>
            <Components></Components>
        </Suspense>
    
}


export default [
    {
        path: '/heros', element:load(Heros), meta: "英雄"

    },
    {
        path: '/redux',  element: <Redux></Redux>, meta: "redux"

    },
    // { path: '/herotext/:id', element: <Herotext></Herotext>,meta:"英雄详情",isHidden:true

    // },
    {
        path: '/herotext', element:load(Herotext), meta: "英雄详情", isHidden: true

    },
    {
        path: '/refs', element: <Refs></Refs>, meta: "refs"
    },
    {
        path: '/homes', element: <Homes></Homes>, meta: "homes"
    },
    {
        path: '/todolist', element: <ToDoList></ToDoList>, meta: "todolist"
    },
    {
        path: '/duanzi', element:load(Duanzi) , meta: "段子"
    },
    {
        path: '/news', element:load(News) ,
        children: [{
            path: '/news/guoji', element: <Guoji></Guoji>, meta: "英雄"
        },
        {
            path: '/news/guonei', element: <Guonei></Guonei>, meta: "英雄"
        }, {
            index: true,
            element: <Navigate to='/news/guonei'></Navigate>
        }

        ]
    }]
